package bird;

import bird.compose.CDuck;
import bird.compose.COstrich;
import bird.compose.CSparrow;
import bird.inherit.AbstractBird;
import bird.inherit.Duck;
import bird.inherit.Ostrich;
import bird.inherit.Sparrow;

import java.util.Date;

/**
 * @author hanjian
 */
public class Application {

    public static void main(String[] args) {
        System.out.println("\ninherit");
        inherit();
        System.out.println("\ncompose");
        compose();
    }

    public static void inherit() {
        Duck duck = new Duck(new Date());
        duck.fly();
        duck.egg();
        duck.call();
        duck.swimming();
        AbstractBird sparrow = new Sparrow(new Date());
        sparrow.fly();
        sparrow.egg();
        sparrow.call();
        AbstractBird ostrich = new Ostrich(new Date());
        ostrich.egg();
        ostrich.call();
//        ostrich.fly();
    }

    public static void compose() {
        CDuck cDuck = new CDuck();
        cDuck.call();
        cDuck.fly();
        cDuck.egg();
        cDuck.swimming();
        COstrich cOstrich = new COstrich();
        cOstrich.call();
        cOstrich.egg();
        CSparrow cSparrow = new CSparrow();
        cSparrow.call();
        cSparrow.fly();
        cSparrow.egg();
    }
}
